
! function ($) {
    $(function () {
        if (!Modernizr.svg) {
            $('img[src*="svg"]').attr('src', function () {
                return $(this).attr('src').replace('.svg', '.png');
            });
        };
				$('.no-fouc').removeClass('no-fouc');
        var searchInput = $('.search');
        searchInput.blur(function() {
            searchInput.animate({width: '200px'});
        });
        searchInput.focus(function() {
            searchInput.animate({width: '250px'});
        });

        $('.js-image-fill').imagefill({throttle:1000/500})

        //Mobile Nav
        var a = $('#selector').html();
        var b = $('#mobile-nav').html(a);



// Tooltip and popover demos
        $('body').tooltip({
            selector: '[data-toggle="tooltip"]',
            container: 'body'
        })
        $('.popover-demo').popover({
            selector: '[data-toggle="popover"]',
            container: 'body'
        })
// Demos within modals
        $('.tooltip-test').tooltip()
        $('.popover-test').popover()
// Popover demos
        $('.bs-docs-popover').popover()
// Button state demo
        $('#loading-example-btn').click(function () {
            var btn = $(this)
            btn.button('loading')
            setTimeout(function () {
                btn.button('reset')
            }, 3000)
        })


       //$( function() {
       //    // init Isotope
       //    var $container = $('.isotope').isotope({
       //        itemSelector: '.product-item',
       //        transitionDuration: '0.6s'
       //    });

       //    // store filter for each group
       //    var filters = {};

       //    $('.js-product-filters').on( 'click', '.js-product-btn', function() {
       //        var $this = $(this);
       //        // get group key
       //        var $buttonGroup = $this.parents('.js-radio-button-group');
       //        var filterGroup = $buttonGroup.attr('data-filter-group');
       //        // set filter for group
       //        filters[ filterGroup ] = $this.attr('data-filter');
       //        // combine filters
       //        var filterValue = '';
       //        for ( var prop in filters ) {
       //            filterValue += filters[ prop ];
       //        }
       //        // set filter for Isotope
       //        $container.isotope({ filter: filterValue });
       //    });

       //    // change is-checked class on buttons
       //    $('.js-radio-button-group').each( function( i, buttonGroup ) {
       //        var $buttonGroup = $( buttonGroup );
       //        $buttonGroup.on( 'click', '.js-product-btn', function() {
       //            $buttonGroup.find('.is-checked').removeClass('is-checked');
       //            $( this ).addClass('is-checked');
       //        });
       //    });

       //});

        //var count = $(".js-product-grid .js-prod-disp-retail").length;
        //$(".js-product-count").html(+count);
        var data = $('.js-wayne-product-region .active').html();
        $('.js-btn-region-select-btn').html(data);





        $( function() {
            // init Isotope
            var $container = $('.js-filter-grid').isotope({
                itemSelector: '.js-filter-item'
            });

            // store filter for each group
            var filters = {};

            $('.js-product-grid').on( 'click', '.js-btn-filter', function() {
                var $this = $(this);
                // get group key
                var $buttonGroup = $this.parents('.btn-group');
                var filterGroup = $buttonGroup.attr('data-filter-group');
                // set filter for group
                filters[ filterGroup ] = $this.attr('data-filter');
                // combine filters
                var filterValue = '';
                for ( var prop in filters ) {
                    filterValue += filters[ prop ];
                }
                // set filter for Isotope
                $container.isotope({ filter: filterValue });
            });

            // change is-checked class on buttons
            $('.js-radio-btn-group').each( function( i, buttonGroup ) {
                var $buttonGroup = $( buttonGroup );
                $buttonGroup.on( 'click', '.js-btn-filter', function() {
                    $buttonGroup.find('.active').removeClass('active');
                    $( this ).addClass('active');
                    $(".js-btn-region-select-btn").text($(this).text());
                    $(".js-btn-filter").val($(this).text());
                    setTimeout(function () {
                        $('.js-wayne-product-region').collapse('hide');
                        if(!$(".js-btn-region-select-btn").hasClass("collapsed")){
                            $(".js-btn-region-select-btn").addClass("collapsed");
                        }
                    }, 3000)
                });
            });

        });





        $(document).ready(function() {

            function M(e, t) {
                var n = 0 - $(window).scrollTop() * t + "px";
                e.css({
                    backgroundPosition: "50% " + n
                })
            }
            var N = $(".parallax-overlay"),
                C = parseInt(N.css("top").replace("px", "")),
                k = navigator.appName,
                L = navigator.userAgent.toLowerCase().indexOf("safari/") > -1,
                A = navigator.userAgent.toLowerCase().indexOf("chrome") > -1,
                O = navigator.userAgent.toLowerCase().indexOf("trident") > -1;
            console.log(navigator.userAgent);
            L && A && (L = !1);
            k != "Microsoft Internet Explorer" && !L && !O && $(window).scroll(function(e) {
                if ($(window).width() > 1024) {
                    var t = $(window).scrollTop();
                    N.css("opacity", 1 - t / C * 1.1);
                    M($(".parallax-bg"), -0.8)
                }
            });

        });

    })
}(jQuery)